package k8sutil

import (
	"fmt"
	"k8s.io/client-go/kubernetes"
)

func GetClusterVersion(cli *kubernetes.Clientset) (string, error) {
	version, err := cli.Discovery().ServerVersion()
	if err != nil {
		return "", fmt.Errorf("failed to get server version: %v", err)
	}
	return version.String(), nil
}
